﻿using System;
using System.Security.Cryptography;
using System.Text;

namespace WebMoney.WMSignerFX.KeysExtractor.Utils
{
    public static class SHA1Hash
    {
        public static string GetHashString(string s)
        {
            if (string.IsNullOrEmpty(s))
                return null;

            byte[] baValue = Encoding.UTF8.GetBytes(s);

            SHA1CryptoServiceProvider cryptoServiceProvider = new SHA1CryptoServiceProvider();
            byte[] baHash = cryptoServiceProvider.ComputeHash(baValue);

            return BitConverter.ToString(baHash, 0).Replace("-", string.Empty);
        }
    }
}